package com.qwc.blog.entity.vo.config;

import com.qwc.blog.common.validate.IdValid;
import com.qwc.blog.entity.Config;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author qwc
 * @Date 2021/11/8 16:18
 */
@Data
public class AddConfigDto {
    @NotNull(groups = IdValid.class, message = "分类主键不能为空")
    private Integer id;
    @NotBlank(message = "配置名称不能为空")
    private String name;
    @NotBlank(message = "配置键名不能为空")
    private String configKey;
    @NotBlank(message = "配置值不能为空")
    private String configValue;
    @NotNull(message = "类型不能为空")
    private Integer type;
    @NotBlank(message = "状态不能为空")
    private String status;
    private String remark;

    public Config createConfig() {
        Config config = new Config();
        config.setId(id);
        config.setName(name);
        config.setConfigKey(configKey);
        config.setConfigValue(configValue);
        config.setType(type);
        config.setStatus(status);
        config.setRemark(remark);
        return config;
    }
}
